package com.example.spring_ai.mcp.service;

import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.stereotype.Service;
import org.springframework.ai.chat.client.ChatClient.Builder;

@Service
public class ChatService {

    private final ChatClient chatClient;

    public ChatService(Builder builder, ToolCallbackProvider tools) {
        this.chatClient = builder.defaultTools(tools).build();
    }

    public String callChat(String prompt) {
        return chatClient.prompt(prompt).call().content();
    }
}
